public class Text8 {
    public static void main(String[] args) {
       int number = 1983;
       //定义一个临时变量记录number的值,方便再次使用
       int temp = number;
       //定义一个变量用于统计个数
        int count = 0;
        while(number != 0){
            //每次循环就去掉右边的一个数字
            number = number / 10;
            count++;
        }
        //定义数组,动态初始化
        int [] arr = new int[count];
        //把整数上的每一位都添加到数组中去
        int index = arr.length - 1;
        while(temp != 0){
            //获取个位
            int ge = temp % 10;
            temp = temp / 10;
            //把当前获取的个位添加到数组中
            arr[index] = ge;
            index--;
        }

        for (int i = 0; i < arr.length; i++) {
            arr[i] = arr[i] + 5;
        }
        for (int i = 0; i < arr.length; i++) {
            arr[i] = arr[i] % 10;
        }
        //两个指针
        for (int i = 0, j = arr.length - 1;i < j;i++,j--){
            int tem = arr[i];
            arr[i] = arr[j];
            arr[j] = tem;
        }
        //拼接
        int num = 0;
        for (int i = 0; i < arr.length; i++) {
            num = num * 10 + arr[i];
        }
        System.out.println("加密后的新数" + num);
    }
}
